package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.mapper.ApplyMapper;
import com.xxx.modules.entity.Apply;
import com.xxx.modules.service.ApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * apply
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2023-04-29
 */
@Service
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements ApplyService {

    @Autowired
    private ApplyMapper applyMapper;


    @Override
    public PageInfo<Apply> selectApplyInfo(Apply apply, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper<Apply> wrapper = new QueryWrapper<>();
        List<Apply> data = applyMapper.selectListInfo(apply);
        return new PageInfo<>(data);
    }

    @Override
    public void saveApplyInfo(Apply apply) {
        apply.setCreateTime(TimeUtil.getCurrentTime());
        applyMapper.insert(apply);
    }

    @Override
    public void updateApplyInfo(Apply apply) {
        applyMapper.updateById(apply);
    }

    @Override
    public void delApplyInfo(Integer id) {
        applyMapper.deleteById(id);
    }

    @Override
    public void delBatchApplyInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        applyMapper.deleteBatchIds(list);
    }


}